/**
 $ @Author: jyq
 $ @Date: 2022-07-01 10:13:13
 $ @LastEditTime: 2022-07-07 14:28:46
 $ @LastEditors: jyq
 $ @Description: 
 $ @FilePath: \dasantest2\day06\vue3-project\src\router\index.js
 $ @可以输入预定的版权声明、个性签名、空行等
 */
 import { createRouter, createWebHistory } from 'vue-router'
 import Home from '../views/HomeView.vue' 
 import Login from '../views/Login.vue'
 import TypeView from '../views/TypeView.vue'
 import ShoppingView from '../views/ShoppingView.vue'
 const routes = [
   {
     path: '/',
     name: 'home',
     component: Home,
     meta: {
      index:0,
      showTabBar: true//在路由meta对象设置一个布尔值showTabBar
  }
   },
   {
     path: '/about',
     name: 'about',
     component: () => import('../views/AboutView.vue'),
     meta: {
      index:1,
      showTabBar: true//在路由meta对象设置一个布尔值showTabBar
  }
   },
   {
    path: '/my',
    name: 'my',
    component: () => import('../views/MyView.vue'),
    meta: {
      index:3,
      showTabBar: true//在路由meta对象设置一个布尔值showTabBar
  }
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('../views/OrdersView.vue'),
    meta: {
      index:2,
      showTabBar: false//在路由meta对象设置一个布尔值showTabBar
  }
  },
  {
    path: '/login',
    name: 'login',
    component:Login,
    meta: {
      showTabBar: false//在路由meta对象设置一个布尔值showTabBar
  }
  },
  {
    path: '/type',
    name: 'type',
    component:TypeView,
    meta: {
      showTabBar: false//在路由meta对象设置一个布尔值showTabBar
  }
  },
  {
    path: '/shop',
    name: 'shop',
    component:ShoppingView,
    meta: {
      showTabBar: false//在路由meta对象设置一个布尔值showTabBar
  }
  },
 ]
 
 const router = createRouter({
   history: createWebHistory(),
   routes
 })
 
 router.afterEach((to) => {
  //解决路由跳转后页面不在顶部的问题
  window.scrollTo(0,0)

 })
 export default router